package com.xoa.controller.attend;

import com.xoa.model.attend.AttendEvection;
import com.xoa.model.attend.AttendEvectionFlowRunPrcs;
import com.xoa.service.attend.AttendEvectionService;
import com.xoa.util.ToJson;
import com.xoa.util.common.wrapper.BaseWrapper;
import com.xoa.util.common.wrapper.BaseWrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by gsb on 2017/7/17.
 */
@RestController
@RequestMapping("/attendEvection")
public class AttendEvectionController {
@Autowired
private AttendEvectionService attendEvectionService;

    /**
     * 创建作者:   牛江丽
     * 创建日期:   2017-7-14 下午14:45:00
     * 方法介绍:   查询出差登记
     */
    @RequestMapping(value = "/queryAllAttendEvection", produces = { "application/json;charset=UTF-8" })
    public ToJson<AttendEvectionFlowRunPrcs> queryAllAttendEvection(@RequestParam(name = "page", required = false, defaultValue = "1") Integer page,
                                                                    @RequestParam(name = "pageSize", required = false, defaultValue = "10") Integer pageSize,
                                                                    @RequestParam(name = "useFlag", required = false, defaultValue = "true")  Boolean useFlag,
                                                                    String allow,HttpServletRequest request){
        return attendEvectionService.queryAllAttendEvection(page,pageSize,useFlag,request,allow);
    }


    @RequestMapping(value = "/addAttendEvection", produces = { "application/json;charset=UTF-8" })
    public BaseWrapper addAttendEvection(String createDate, HttpServletRequest request){
        return attendEvectionService.addAttendEvection(createDate,request);
    }

    @RequestMapping(value = "/backlogAttendList", produces = { "application/json;charset=UTF-8" })
    public BaseWrappers backlogAttendList(HttpServletRequest request, String num,
                                          @RequestParam(name = "page", required = false, defaultValue = "1") Integer page,
                                          @RequestParam(name = "pageSize", required = false, defaultValue = "10") Integer pageSize,
                                          @RequestParam(name = "useFlag", required = false, defaultValue = "true")  Boolean useFlag){
        return attendEvectionService.backlogAttendList(request,num,page,pageSize,useFlag);
    }
    /**
     * 创建人：季佳伟
     * 创建时间：2017-11-21  下午5:40:17
     * 方法介绍：查询登录人一段时间内的出差状况
     * 参数说明：
     */
    @RequestMapping(value = "/selectAttendEvectionByUserId", produces = { "application/json;charset=UTF-8" })
    public ToJson<AttendEvection> selectAttendEvectionByUserId(String beginDate, String endDate,HttpServletRequest req){
        return attendEvectionService.selectAttendEvectionByUserId(beginDate, endDate, req);
    }


    }
